<?php

namespace App\Model;

use Think\Model;

class BaseModel extends Model
{


    //根据id查找，如果为空，抛出异常
    public function findOrFail($id)
    {
        $row = $this->find($id);
        if ($row) return $row;
        throw new \Exception(get_called_class() . ": row(id: $id) not found");
    }


}